package com.fy.tt.action;



import com.fy.basejar.tool.ActionToolBase;
import com.fy.toolhelper.util.ResponseUtils;
import com.fy.tt.dao.ParserDao;
import com.fy.tt.dao.impl.ParserDaoImpl;
import com.fy.tt.service.ParserService;
import com.fy.tt.service.impl.ParserServiceImpl;

import javax.servlet.http.HttpServletRequest;
import java.util.Map;

public class ParserController extends ActionToolBase {


    @Action
    public Map<String,Object> getAllParser(HttpServletRequest request) throws Exception{
        return ResponseUtils.asResultAndMsg("data","msg");
    }





    /* 这里是模拟Spring管理Bean提供的类实例管理的声明部分(没有依赖注入的处理, 所以不要把要用到的Bean声明为类成员变量)
     * 所有用到的Bean都要声明, 否则报错, 并且强烈建议forClass为接口, 注意保持声明方法的返回值类型与forClass一致*/

    @BeanDeclare(forClass = ParserService.class, scope = BeanScope.TEMPORY)
    private ParserService onDeclaringParserService() {
        // 这样做的好处是保留开发者自定义初始化的编程能力, 当然简单实例化情况下这样写也挺麻烦的
        return new ParserServiceImpl();
    }

    @BeanDeclare(forClass = ParserDao.class, scope = BeanScope.TEMPORY)
    private ParserDao onDeclaringParserDao() throws Exception {
        return new ParserDaoImpl();
    }

}

